/*
 * @Description:
 * @Author: cgt
 * @Date: 2021-10-20 17:40:38
 * @LastEditors: cgt
 * @LastEditTime: 2021-12-28 19:41:01
 */
/**
 * @module init/initConfig
 * @desc 初始化参数配置
 */


class Config {
  constructor() {
    this.config = {
      ICON_BASE_WIDTH: 50,
      ICON_BASE_HEIGHT: 50,
      RESOURCE_BASEURL: './icons/',
      SCHEMA: 'fzgh_202104',
      BASE_SCHEMA: 'fzgh',
      SSSDW: '江苏省',
      APIBASEURL: '/api',
      SYS_DSNOS: [5]
    };
  }

  setConfig(config) {
    for (var key in config) {
      this.config[key] = config[key];
    }
  }

  getAllConfig() {
    return this.config;
  }

  get(key) {
    return this.config[key];
  }
}


/**
 * 初始化参数配置
 * @param {Map} top 地图开放顶层
 * @param {Object} options 参数配置
 */
export function initConfig(top, options) {
  top.config = new Config();
  top.config.setConfig(options);
}